package com.gmscosmo.request;

public class JanusRequest {
    private String janus;
    private Long session_id;
    private Long handle_id;
    private String opaque_id;
    private String plugin;
    private String transaction;
    JanusRequestBody body;
    private Jsep jsep;
    private String candidate;

    public JanusRequest() {

    }

    public JanusRequest(String janus) {
        this.janus = janus;
        this.transaction = initTransaction(12);
    }

    public String getJanus() {
        return janus;
    }

    public void setJanus(String janus) {
        this.janus = janus;
    }

    public String getOpaque_id() {
        return opaque_id;
    }

    public void setOpaque_id(String opaque_id) {
        this.opaque_id = opaque_id;
    }

    public String getPlugin() {
        return plugin;
    }

    public void setPlugin(String plugin) {
        this.plugin = plugin;
    }

    public String getTransaction() {
        return transaction;
    }

    public void setTransaction(String transaction) {
        this.transaction = transaction;
    }

    public JanusRequestBody getBody() {
        return body;
    }

    public void setBody(JanusRequestBody body) {
        this.body = body;
    }

    public Jsep getJsep() {
        return jsep;
    }

    public void setJsep(Jsep jsep) {
        this.jsep = jsep;
    }

    public String getCandidate() {
        return candidate;
    }

    public void setCandidate(String candidate) {
        this.candidate = candidate;
    }

    public Long getSession_id() {
        return session_id;
    }

    public void setSession_id(Long session_id) {
        this.session_id = session_id;
    }

    public Long getHandle_id() {
        return handle_id;
    }

    public void setHandle_id(Long handle_id) {
        this.handle_id = handle_id;
    }

    private String initTransaction(int len) {
        String charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        String randomString = "";
        for (int i = 0; i < len; i++) {
            int randomPoz = (int) Math.floor(Math.random() * charSet.length());
            randomString += charSet.substring(randomPoz, randomPoz + 1);
        }
        return randomString;
    }
}
